<template>
  <page-header-wrapper>
    <page-tab-list></page-tab-list>
    <a-card :bordered="false">
      <!-- ref="coordinateForm" -->
      <a-form
        action=""
        method="post"
        :labelCol="{ span: 6 }"
        :wrapperCol="{ span: 16 }"
      >
        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="产品注明"
        >
          <a-radio-group name="note_show" v-model="note_show">
            <a-radio :value="1"> 显示 </a-radio>
            <a-radio :value="0"> 隐藏 </a-radio>
          </a-radio-group>
        </a-form-item>

        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="产品注明"
        >
          <a-textarea
            :rows="4"
            type="text"
            placeholder="请填写打印订单的产品注明"
            name="note"
            v-model="note"
          />
        </a-form-item>

        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="货到付款订单提示信息"
        >
          <a-textarea
            :rows="4"
            type="text"
            placeholder="请填写提示信息"
            name="not_pay_notice"
            v-model="not_pay_notice"
          />
        </a-form-item>

        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="已支付订单提示信息"
        >
          <a-textarea
            :rows="4"
            type="text"
            placeholder="请填写提示信息"
            name="pay_notice"
            v-model="pay_notice"
          />
        </a-form-item>

        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="二维码"
        >
          <a-radio-group name="qrcode_show" v-model="qrcode_show">
            <a-radio :value="1"> 显示 </a-radio>
            <a-radio :value="0"> 隐藏 </a-radio>
          </a-radio-group>
        </a-form-item>
      </a-form>
      <div style="text-align: center">
        <a-button @click="submitForm" type="primary">保存</a-button>
      </div>
    </a-card>
  </page-header-wrapper>
</template>
  
  <script>
import {
  getPrintOrderSetting,
  setPrintOrderSetting,
} from "@/api/setting/printer";
import { STable } from "@/components";
import pick from "lodash.pick";

export default {
  name: "PrinterOrderSetting",
  components: {
    STable,
  },
  data() {
    return {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 17 },
      },

      note_show: 0,
      not: "",
      qrcode_show: 0,
      pay_notice:'',
      not_pay_notice:'',
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData(parameter) {
      this.loadData = null;
      return getPrintOrderSetting(parameter).then((res) => {
        this.note_show = res.data.note_show;
        this.note = res.data.note;
        this.qrcode_show = res.data.qrcode_show;
        this.not_pay_notice = res.data.not_pay_notice;
        this.pay_notice = res.data.pay_notice;
      });
    },
    submitForm: function () {
      console.log("zoudao zheli ");

      setPrintOrderSetting({
        note_show: this.note_show,
        note: this.note,
        qrcode_show: this.qrcode_show,
        not_pay_notice:this.not_pay_notice,
        pay_notice:this.pay_notice
      })
        .then((res) => {
          if (res.code == 0) {
            this.$message.success("保存成功！");
          } else {
            this.$message.warning(res.msg ? res.msg : "保存失败！");
          }
        })
        .catch((error) => {
          console.log(error);
        })
        .then(() => {
          this.btnLoading = false;
        });
    },
  },
};
</script>
  <style lang="less" scoped>
.required::before {
  content: "*";
  color: red;
}
</style>
  